import 'package:built_collection/built_collection.dart';
import 'package:backend.core/core/domain/errors/failures.dart';
import 'package:dartz/dartz.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_purchased_item.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_purchased_item_identifier.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_revoked_purchased_item.dart';

part 'failures/google_play_api_one_time_purchased_item_acknowledgement_failure.dart';

part 'failures/google_play_api_one_time_purchased_item_getting_failure.dart';

part 'failures/google_play_api_purchased_subscription_acknowledgement_failure.dart';

part 'failures/google_play_api_purchased_subscription_getting_failure.dart';

part 'failures/google_play_api_revoked_purchased_item_getting_failure.dart';

abstract class GooglePlayApiPurchasedItemRepository {
  Future<
      Either<GooglePlayApiRevokedPurchasedItemGettingFailure,
          BuiltList<GooglePlayApiRevokedPurchasedItem>>> getRevokedPurchasedItems();

  Future<Either<GooglePlayApiOneTimePurchasedItemGettingFailure, GooglePlayApiOneTimePurchasedItem>>
      getOneTimePurchasedItem({
    required GooglePlayApiPurchasedItemIdentifier purchasedItemIdentifier,
  });

  Future<
      Either<GooglePlayApiPurchasedSubscriptionGettingFailure,
          GooglePlayApiPurchasedSubscription>> getPurchasedSubscription({
    required GooglePlayApiPurchasedItemIdentifier purchasedItemIdentifier,
  });

  Future<Either<GooglePlayApiOneTimePurchasedItemAcknowledgementFailure, void>>
      acknowledgeOneTimePurchasedItem({
    required GooglePlayApiPurchasedItemIdentifier purchasedItemIdentifier,
  });

  Future<Either<GooglePlayApiPurchasedSubscriptionAcknowledgementFailure, void>>
      acknowledgePurchasedSubscription({
    required GooglePlayApiPurchasedItemIdentifier purchasedItemIdentifier,
  });
}
